<template>
	<view class="cancel_box">
		<view class="card">
			<view class="phone">
				<text>您正在注销乐附近账户</text>
				<view>{{mobile.substr(0,3) + "****" + mobile.substr(7)}}</view>
			</view>
			<view class="box flex_c">
				<image src="/static/login/cancel.png"></image>
				<view class="text">
					账户注销后包括但不限于以下信息的所有数据将被清空，请谨慎操作。
				</view>
				<view class="select">
					<view class="item" @click="onSelect(0)">
						<uni-icons type="smallcircle" v-if="select[0]" color="#EF5233" :size="22"></uni-icons>
						<uni-icons type="circle" v-else color="#D6D6D6" :size="22"></uni-icons>
						<view>账户个人信息，历史交易记录将被清空且无法找回；</view>
					</view>
					<view class="item" @click="onSelect(1)">
						<uni-icons type="smallcircle" v-if="select[1]" color="#EF5233" :size="22"></uni-icons>
						<uni-icons type="circle" v-else color="#D6D6D6" :size="22"></uni-icons>
						<view>账户会员身份、优惠券视为放弃，数据无法找回；</view>
					</view>
					<view class="item" @click="onSelect(2)">
						<uni-icons type="smallcircle" v-if="select[2]" color="#EF5233" :size="22"></uni-icons>
						<uni-icons type="circle" v-else color="#D6D6D6" :size="22"></uni-icons>
						<view>账户绑定的平台技师身份将被删除，无法在平台接单；</view>
					</view>
					<view class="item" @click="onSelect(3)">
						<uni-icons type="smallcircle" v-if="select[3]" color="#EF5233" :size="22"></uni-icons>
						<uni-icons type="circle" v-else color="#D6D6D6" :size="22"></uni-icons>
						<view>账户绑定技师的钱包未提现余额将被删除，数据无法找回。</view>
					</view>
				</view>

				<view class="err">
					为保护您的权益，请确保您所有的订单均已完成且无纠纷，否则将暂时无法进行注销操作。
				</view>
			</view>
		</view>
		
		
		<view class="btn" @click="toCancel">已清楚风险，确认注销</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile: '',

				select: [false, false, false, false]
			}
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},
			toRich() {
				uni.navigateTo({
					url: '/otherpages/setting/policy/detail?type=logout'
				})
			},
			onSelect(e) {
				this.select[e] = !this.select[e]
				this.select = JSON.parse(JSON.stringify(this.select))
			},
			toCancel() {
				let flag = true
				this.select.forEach(item => {
					if (!item) {
						flag = false
					}
				})

				if (!flag) {
					return this.$util.msg('请先阅读并同意全部条款')
				}
				uni.navigateTo({
					url: '/otherpages/setting/canelCode'
				})
			},
		},
		onLoad() {
			this.mobile = uni.getStorageSync('user').mobile
		}
	}
</script>

<style lang="less" scoped>
	.cancel_box {
		min-height: 100vh;
		padding: 30rpx 30rpx 130rpx;
	}

	.btn {
		position: fixed;
		left: 50%;
		transform: translateX(-50%);
		bottom: 30rpx;
		width: 690rpx;
		height: 90rpx;
		background: #EF5233;
		border-radius: 44rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 90rpx;
		text-align: center;
	}

	view {
		box-sizing: border-box;
	}

	.card {
		background: #FFFFFF;
		border-radius: 10rpx;

		.phone {
			width: 100%;
			height: 170rpx;
			background: #FEE5E0;
			border-radius: 14rpx;
			border: 1rpx solid #EF5233;
			padding: 30rpx;

			text {
				font-size: 32rpx;
				font-weight: 600;
				color: #272727;
				line-height: 45rpx;
			}

			view {
				font-size: 40rpx;
				font-weight: 600;
				color: #EF5233;
				line-height: 56rpx;
				margin-top: 10rpx;
			}
		}

		.box {
			padding: 46rpx 30rpx 38rpx;

			image {
				width: 100rpx;
				height: 100rpx;
			}

			.text {
				width: 467rpx;
				font-size: 28rpx;
				font-weight: 600;
				color: #010102;
				line-height: 40rpx;
				margin: 30rpx 0;
			}

			.select {
				width: 100%;
				background: #F5F7F8;
				border-radius: 10rpx;
				padding: 30rpx;

				.item {
					display: flex;
					align-items: flex-start;
					margin-bottom: 10rpx;

					view {
						font-size: 26rpx;
						color: #010101;
						line-height: 45rpx;
						margin-left: 20rpx;
					}
				}
			}

			.err {
				font-size: 22rpx;
				color: #ACACAC;
				line-height: 30rpx;
				margin-top: 26rpx;
			}
		}
	}
</style>